﻿package game 
{
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import game.exchangeddata.BetStatusInfo;
	import game.events.EventData;
	import game.exchangeddata.HashTable;
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (Bamboo)
	 */
	public class BetStatusPanel extends MovieClip
	{
		public var txtPastTf:TextField;
		public var txtOkTf:TextField
		public var txtBetRecTf:TextField;
		public var txtDateTf:TextField;
		public var txtTimeTf:TextField;
		public var txtTableTf:TextField;
		public var txtGameSetTf:TextField;
		public var txtBetCodeTf:TextField;
		public var txtResultTf:TextField;
		public var txtAmountTf:TextField;
		public var txtWinTf:TextField;
		public var txtCommissionAmountTf:TextField;
		public var txtReportMessageTf:TextField;
		
		public var btnCloseReport:SimpleButton;
		
		public var txtBetRecNoTf:TextField;
		public var txtDateNoTf:TextField;
		public var txtTimeNoTf:TextField;
		public var txtTableNoTf:TextField;
		public var txtGameSetNoTf:TextField;
		public var txtBetCodeNoTf:TextField;
		public var txtResultNoTf:TextField;
		public var txtAmountNoTf:TextField;
		public var txtWinNoTf:TextField;
		public var txtCommissionAmountNoTf:TextField;
		public var pageControl:PageControl;
		//public var pageView_mc:MovieClip;
		
		public function BetStatusPanel() 
		{
			hide();
			this.txtOkTf.mouseEnabled = false;
			this.btnCloseReport.addEventListener(MouseEvent.CLICK, closeHdl);
		}
		
		private function closeHdl(e:Event):void 
		{
			hide();
		}
		
		public function initText(hashTableInfo:HashTable):void {
			this.txtPastTf.text =  hashTableInfo.lookupString("presultMsg");
			this.txtOkTf.text = hashTableInfo.lookupString("btnOK");
			this.txtBetRecTf.text = hashTableInfo.lookupString("betNoMsg");
			this.txtDateTf.text = hashTableInfo.lookupString("DateMsg");
			this.txtTimeTf.text = hashTableInfo.lookupString("TimeMsg");
			this.txtTableTf.text = hashTableInfo.lookupString("tblMsg");
			this.txtGameSetTf.text =  hashTableInfo.lookupString("gameMsg");
			this.txtBetCodeTf.text = hashTableInfo.lookupString("betMsg");
			this.txtResultTf.text = hashTableInfo.lookupString("resultMsg");
			this.txtAmountTf.text = hashTableInfo.lookupString("amountMsg");
			this.txtWinTf.text = hashTableInfo.lookupString("winMsg");
		}
		
		public function updateValueBetStatus(info:Object):void {
			var betStatus:BetStatusInfo = BetStatusInfo(info);
			this.txtBetRecNoTf.text = betStatus.betRecNo;
			this.txtDateNoTf.text = betStatus.dateNo;
			this.txtTimeNoTf.text = betStatus.timeNo;
			this.txtTableNoTf.text = betStatus.tableNo;
			this.txtGameSetNoTf.text = betStatus.gameSetNo;
			this.txtBetCodeNoTf.text = betStatus.betCodeNo;
			this.txtResultNoTf.text = betStatus.resultNo;
			this.txtAmountNoTf.text = betStatus.amountNo;
			this.txtWinNoTf.text = betStatus.winNo;
			this.txtCommissionAmountNoTf.text = betStatus.commissionAmountNo;
			if(betStatus.addPage)
				this.pageControl.addPageToPageList(this.pageControl.pageList, betStatus.pageNum);
			betStatus.addPage = false;
		}
		
		public function show():void {
			this.visible = true;
		}
		
		public function hide():void {
			this.visible = false;
		}
	}

}